﻿<%@ Page Title="" Language="C#" MasterPageFile="~/backend/MasterPage_backend.master" AutoEventWireup="true" CodeFile="OrderManagement.aspx.cs" Inherits="OrderManagement" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <!-- header-starts -->
			<div class="header-section">
				</div>
				<div class="header_bg">					
							<div class="header">
								<div class="head-t">
									<div class="logo">
										<a href="index.html"><img src="images/logo.png" class="img-responsive" alt=""> </a>
									</div>
										<!-- start header_right -->
									<div class="header_right">
										<div class="rgt-bottom">
										<div class="cart box_1">
											<a href="#">
												<h3> <span class="simpleCart_total">订单管理系统 OrderManagement</span></h3>
											</a>	
                                            <p>&nbsp;</p>
											<div class="clearfix"> </div>
										</div>
										<div class="clearfix"> </div>
									</div>
									<div class="search">
										<form>
											<input type="text" value="" placeholder="search...">
											<input type="submit" value="">
										</form>
									</div>
									<div class="clearfix"> </div>
								</div>
								<div class="clearfix"> </div>
							</div>
						</div>
					
				</div>
					<!-- //header-ends -->
<div class="content">
        <div class="fo-top-di">
            <%--下部信息--%>
	        <div class="foot-top">
                    <table class="style1">
                        <tr>
                            <td id="s" class="style3">
                                &nbsp;</td>
                            <td class="style3" style="width: 756px">
                                筛选时间：<asp:DropDownList ID="DropDownList1" 
                                    runat="server" AutoPostBack="True" 
                                    DataSourceID="SEEK" DataTextField="InTime" DataValueField="InTime" 
                                    Width="270px">
                                </asp:DropDownList>
                                <asp:SqlDataSource ID="SEEK" runat="server" 
                                    ConnectionString="<%$ ConnectionStrings:HotelManagementConnectionString %>" 
                                    SelectCommand="SELECT [InTime] FROM [Order]"></asp:SqlDataSource>
                                <asp:SqlDataSource ID="ROMM" runat="server" 
                                    ConnectionString="<%$ ConnectionStrings:HotelManagementConnectionString %>" 
                                    SelectCommand="SELECT * FROM [Hotel]"></asp:SqlDataSource>
                            </td>
                            <td style="width: 575px">
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                                &nbsp;</td>
                            <td class="style3" style="width: 688px" align="center">
                                <%--下部信息--%>
                                   <lable align="center" class="style1">
                                         <asp:Button  ID="Button1" runat="server"  onmouseover="this.style.backgroundColor='black';" onmouseout="this.style.backgroundColor='';"
                                    onclick="Button1_Click" Text="添加订单" class="order_button"  />
                                         &nbsp;&nbsp;&nbsp;<asp:Button ID="Button4" runat="server" Text="取消订单"  onmouseover="this.style.backgroundColor='black';" onmouseout="this.style.backgroundColor='';"
                                    onclick="Button4_Click" class="order_button" />
                                   </lable>
                            </td>
                        </tr>
                    </table>

        <asp:Panel ID="Panel1" runat="server">
        <asp:SqlDataSource ID="HTDS" runat="server" 
    ConnectionString="<%$ ConnectionStrings:HotelManagementConnectionString %>" 
    DeleteCommand="DELETE FROM [Order] WHERE(OrderNo=@OrderNo)" 
    InsertCommand="INSERT INTO [Order] (CName, Telephone, HNo, InTime, OutTime, TotalPrice, SNo) VALUES (@CName, @Telephone, @HNo, @InTime, @OutTime, @TotalPrice, @SNo)" 
    SelectCommand="SELECT * FROM [Order]" 
    UpdateCommand="UPDATE [Order] SET CName = @CName, Telephone = @Telephone, HNo = @HNo, InTime = @InTime, OutTime = @OutTime, TotalPrice = @TotalPrice, SNo = @SNo WHERE (OrderNo = @OrderNo)">
            <DeleteParameters>
                <asp:Parameter Name="OrderNo" />
                <asp:Parameter Name="CName" />
                <asp:Parameter Name="Telephone" />
                <asp:Parameter Name="HNo" />
                <asp:Parameter Name="InTime" />
                <asp:Parameter Name="OutTime" />
                <asp:Parameter Name="TotalPrice" />
                <asp:Parameter Name="SNo" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="OrderNo" />
                <asp:Parameter Name="CName" />
                <asp:Parameter Name="Telephone" />
                <asp:Parameter Name="HNo" />
                <asp:Parameter Name="InTime" />
                <asp:Parameter Name="OutTime" />
                <asp:Parameter Name="TotalPrice" />
                <asp:Parameter Name="SNo" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="CName" />
                <asp:Parameter Name="Telephone" />
                <asp:Parameter Name="HNo" />
                <asp:Parameter Name="InTime" />
                <asp:Parameter Name="OutTime" />
                <asp:Parameter Name="TotalPrice" />
                <asp:Parameter Name="SNo" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <br />
    </asp:Panel>

    <asp:Panel ID="Panel2" runat="server" Visible="False">
    <p>&nbsp;</p>
        <asp:DetailsView ID="DetailsView1" runat="server" 
    AutoGenerateRows="False" BackColor="White" BorderColor="#CCCCCC" 
    BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="OrderNo" 
    DataSourceID="HTDS" DefaultMode="Insert" GridLines="Horizontal" 
    Height="500px" Width="100%"  
            HorizontalAlign="Center" 
            
            style="color: #CCCCCC; font-weight: 700; background-color: #666666" 
            onpageindexchanging="DetailsView1_PageIndexChanging" ForeColor="Black">
            <EditRowStyle BackColor="#CC3333" Font-Bold="True" 
        ForeColor="White" />
            <Fields>
                <asp:BoundField DataField="OrderNo" HeaderText="订单编号：" 
            InsertVisible="False" SortExpression="OrderNo" >
                <HeaderStyle Width="150px" />
                </asp:BoundField>
                <asp:BoundField DataField="CName" HeaderText="客户姓名：" 
            SortExpression="CName">
                <HeaderStyle Width="150px" />
                <ItemStyle ForeColor="Black" HorizontalAlign="center" />
                </asp:BoundField>
                <asp:BoundField DataField="Telephone" 
            HeaderText="手机号：" SortExpression="Telephone" >
                <ItemStyle ForeColor="Black" HorizontalAlign="center" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="房间编号：" SortExpression="HNo">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("SNo") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:SqlDataSource ID="HNo1" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:HotelManagementConnectionString %>" 
                            SelectCommand="SELECT [HNo] FROM [Hotel]"></asp:SqlDataSource>
                        <asp:DropDownList ID="DropDownList7" runat="server" DataSourceID="HNo1" 
                            DataTextField="HNo" DataValueField="HNo" 
                            SelectedValue='<%# Bind("HNo") %>' >
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("HNo") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle ForeColor="Black" HorizontalAlign="center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="入住时间：" SortExpression="InTime">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("InTime") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("InTime") %>'></asp:TextBox>
                        <asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="…" />
                        <asp:Calendar ID="Calendar1" runat="server" BackColor="White" 
                            BorderColor="Black" DayNameFormat="Shortest" Font-Names="Times New Roman" 
                            Font-Size="10pt" ForeColor="Black" Height="220px" align="center" NextPrevFormat="FullMonth" 
                            onselectionchanged="Calendar1_SelectionChanged" 
                            SelectedDate='<%# Bind("InTime") %>' TitleFormat="Month" Visible="False" 
                            Width="400px">
                            <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" 
                                ForeColor="#333333" Height="10pt" />
                            <DayStyle Width="14%" />
                            <NextPrevStyle Font-Size="8pt" ForeColor="White" />
                            <OtherMonthDayStyle ForeColor="#999999" />
                            <SelectedDayStyle BackColor="#CC3333" ForeColor="White" />
                            <SelectorStyle BackColor="#CCCCCC" Font-Bold="True" Font-Names="Verdana" 
                                Font-Size="8pt" ForeColor="#333333" Width="1%" />
                            <TitleStyle BackColor="Black" Font-Bold="True" Font-Size="13pt" 
                                ForeColor="White" Height="14pt" />
                            <TodayDayStyle BackColor="#CCCC99" />
                        </asp:Calendar>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("InTime") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle ForeColor="Black" HorizontalAlign="center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="退房时间：" SortExpression="OutTime">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("OutTime") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("OutTime") %>'></asp:TextBox>
                        <asp:Button ID="Button3" runat="server" onclick="Button3_Click" Text="…" />
                        <asp:Calendar ID="Calendar2" runat="server" BackColor="White" 
                            BorderColor="Black" DayNameFormat="Shortest" Font-Names="Times New Roman" 
                            Font-Size="10pt" ForeColor="Black" Height="220px" align="center" NextPrevFormat="FullMonth" 
                            onselectionchanged="Calendar2_SelectionChanged" 
                            SelectedDate='<%# Bind("OutTime") %>' TitleFormat="Month" Visible="False" 
                            Width="400px">
                            <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" 
                                ForeColor="#333333" Height="10pt" />
                            <DayStyle Width="14%" />
                            <NextPrevStyle Font-Size="8pt" ForeColor="White" />
                            <OtherMonthDayStyle ForeColor="#999999" />
                            <SelectedDayStyle BackColor="#CC3333" ForeColor="White" />
                            <SelectorStyle BackColor="#CCCCCC" Font-Bold="True" Font-Names="Verdana" 
                                Font-Size="8pt" ForeColor="#333333" Width="1%" />
                            <TitleStyle BackColor="Black" Font-Bold="True" Font-Size="13pt" 
                                ForeColor="White" Height="14pt" />
                            <TodayDayStyle BackColor="#CCCC99" />
                        </asp:Calendar>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("OutTime") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle ForeColor="Black" HorizontalAlign="center" />
                </asp:TemplateField>
                <asp:BoundField DataField="TotalPrice" 
            HeaderText="总价：" SortExpression="TotalPrice" >
                <ItemStyle ForeColor="Black" HorizontalAlign="center" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="操作员编号：" SortExpression="SNo">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("SNo") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:SqlDataSource ID="SNO1" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:HotelManagementConnectionString %>" 
                            SelectCommand="SELECT [SNo] FROM [Staff]"></asp:SqlDataSource>
                        <asp:DropDownList ID="DropDownList6" runat="server" AutoPostBack="True" 
                            DataSourceID="SNO1" DataTextField="SNo" DataValueField="SNo" 
                            SelectedValue='<%# Bind("SNo") %>'>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("SNo") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle ForeColor="Black" HorizontalAlign="center" />
                </asp:TemplateField>
                <asp:CommandField ShowInsertButton="True" CancelText="" InsertText="新增订单" >
                <ItemStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                </asp:CommandField>
            </Fields>
            <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
            <HeaderStyle BackColor="#333333" Font-Bold="True" 
        ForeColor="White" />
            <PagerStyle BackColor="White" ForeColor="Black" 
        HorizontalAlign="Right" />
        </asp:DetailsView>
    </asp:Panel>













			    <div class="clearfix"> </div>	            		
		    </div>
       <%--下部信息--%>
            <div class="footer">
                              <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" CellPadding="3" DataKeyNames="OrderNo" 
                        DataSourceID="HTDS" ForeColor="Black" GridLines="Vertical" 
                        style="margin-right: 0px; text-align: center;" Width="100%" 
                        HorizontalAlign="Right" 
                        onselectedindexchanged="GridView1_SelectedIndexChanged" BackColor="White" 
                                  BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px">
                        <AlternatingRowStyle BackColor="#CCCCCC" />
                        <Columns>
                            <asp:BoundField DataField="OrderNo" HeaderText="订单号" InsertVisible="False" 
                                ReadOnly="True" SortExpression="OrderNo" >
                            <HeaderStyle BackColor="Black" Width="70px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="CName" HeaderText="客户名称" SortExpression="CName" >
                            <HeaderStyle BackColor="Black" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Telephone" HeaderText="手机号" 
                                SortExpression="Telephone" >
                            <HeaderStyle BackColor="Black" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="房间编号" SortExpression="HNo">
                                <EditItemTemplate>
                                    <asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True" 
                                        DataSourceID="HN" DataTextField="HNo" DataValueField="HNo" 
                                        SelectedValue='<%# Bind("HNo") %>'>
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="HN" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:HotelManagementConnectionString %>" 
                                        SelectCommand="SELECT [HNo] FROM [Hotel]"></asp:SqlDataSource>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("HNo") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle BackColor="Black" Width="70px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="入住时间" SortExpression="InTime">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("InTime") %>'></asp:TextBox>
                                    <asp:Button ID="Button5" runat="server" onclick="Button5_Click" Text="…" />
                                    <asp:Calendar ID="Calendar3" runat="server" 
                                        onselectionchanged="Calendar3_SelectionChanged" 
                                        SelectedDate='<%# Bind("InTime") %>' Visible="False"></asp:Calendar>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("InTime") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle BackColor="Black" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="退房时间" SortExpression="OutTime">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("OutTime") %>'></asp:TextBox>
                                    <asp:Button ID="Button6" runat="server" onclick="Button6_Click" Text="…" />
                                    <asp:Calendar ID="Calendar4" runat="server" 
                                        onselectionchanged="Calendar4_SelectionChanged" 
                                        SelectedDate='<%# Bind("OutTime") %>' Visible="False"></asp:Calendar>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("OutTime") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle BackColor="Black" />
                            </asp:TemplateField>
                            <asp:BoundField DataField="TotalPrice" HeaderText="总价" 
                                SortExpression="TotalPrice" >
                            <HeaderStyle BackColor="Black" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="操作员编号" SortExpression="SNo">
                                <EditItemTemplate>
                                    <asp:DropDownList ID="DropDownList4" runat="server" AutoPostBack="True" 
                                        DataSourceID="SNo" DataTextField="SNo" DataValueField="SNo" 
                                        SelectedValue='<%# Bind("SNo") %>'>
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="SNo" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:HotelManagementConnectionString %>" 
                                        SelectCommand="SELECT [SNo] FROM [Staff]"></asp:SqlDataSource>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("SNo") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle BackColor="Black" />
                            </asp:TemplateField>
                            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" EditText="更改信息" 
                                HeaderText="操作" >
                            <HeaderStyle BackColor="Black" />
                            <ItemStyle ForeColor="#0066CC" />
                            </asp:CommandField>
                        </Columns>
                        <FooterStyle BackColor="#CCCCCC" />
                        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
                        <SortedAscendingCellStyle BackColor="#F1F1F1" />
                        <SortedAscendingHeaderStyle BackColor="#808080" />
                        <SortedDescendingCellStyle BackColor="#CAC9C9" />
                        <SortedDescendingHeaderStyle BackColor="#383838" />
                    </asp:GridView>
















	            <div class="clearfix"> </div>
		             <p>@ 2017 HotelManagement. All Rights Reserved | Design by <a href="#">us</a></p>
            </div>
        </div>
    </div>
</asp:Content>

